home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / pupworld.swf / scripts / __Packages / Heroes / AttackBox.as < prev    next >
Encoding:
Text File  |  2011-06-09  |  1.8 KB  |  46 lines

  1. class Heroes.AttackBox extends Heroes.AnyBox
  2. {
  3.    var grandParent;
  4.    var myBox;
  5.    var power;
  6.    var forceFall;
  7.    function AttackBox()
  8.    {
  9.       super();
  10.       this.grandParent = this._parent._parent._name;
  11.       if(this._parent._parent.facing == "right")
  12.       {
  13.          this.myBox = new Heroes.Box(this._x + this._parent._parent.x,this._parent._parent.y - this._y,this._parent._parent.z - this._width / 2,this._width,this._height,this._width);
  14.       }
  15.       else
  16.       {
  17.          this.myBox = new Heroes.Box(this._parent._parent.x - this._x - this._width,- this._parent._parent.y - this._y,this._parent._parent.z - this._width / 2,this._width,this._height,this._width);
  18.       }
  19.       this.attack();
  20.    }
  21.    function onEnterFrame()
  22.    {
  23.       if(this._parent._parent.facing == "right")
  24.       {
  25.          this.myBox.setLocation(this._x + this._parent._parent.x,this._parent._parent.y - this._y,this._parent._parent.z - this._width / 2);
  26.       }
  27.       else
  28.       {
  29.          this.myBox.setLocation(this._parent._parent.x - this._x - this._width,- this._parent._parent.y - this._y,this._parent._parent.z - this._width / 2);
  30.       }
  31.       this.myBox.setSize(this._width,this._height,this._width);
  32.       this.attack();
  33.    }
  34.    function attack()
  35.    {
  36.       if(this._parent._parent.facing == "right")
  37.       {
  38.          this._parent._parent._parent.player.onAttack(this.myBox,this.power,this.forceFall,this._parent._parent.facing,this._parent._parent._x + this._x,this._parent._parent._y + this._y - this._height / 2);
  39.       }
  40.       else
  41.       {
  42.          this._parent._parent._parent.player.onAttack(this.myBox,this.power,this.forceFall,this._parent._parent.facing,this._parent._parent._x - this._x,this._parent._parent._y + this._y - this._height / 2);
  43.       }
  44.    }
  45. }
  46.